//
//  LYCATransition.swift
//  1010
//
//  Created by 米明 on 15/7/8.
//  Copyright (c) 2015年 米明. All rights reserved.
//

import UIKit

// 参数说明：
/*
type:
`fade', 渐变 `moveIn' 进入, `push' 推出 `reveal'. 展现 cube 立方 suckEffect 吸收 oglFlip 上下翻转 rippleEffect  水滴 pageCurl 卷页 cameraIrisHollowOpen 开相机 cameraIrisHollowClose 关相机
subtype:
fromLeft', `fromRight', `fromTop' and
`fromBottom'
timingFunction:
linear', `easeIn', `easeOut' and
`easeInEaseOut'
*/
//type
let Fade = "fade"
let MoveIn = "moveIn"
let Push = "push"
let Reveal = "reveal"
let Cube = "cube"
let SuckEffect = "suckEffect"
let OglFlip = "oglFlip"
let RippleEffect = "rippleEffect"
let PageCurl = "pageCurl"
let CameraIrisHollowOpen = "cameraIrisHollowOpen"
let CameraIrisHollowClose = "cameraIrisHollowClose"

//subtype:
let FromLeft = "fromLeft"
let FromRight = "fromRight"
let FromTop = "fromTop"
let FromBottom = "fromBottom"

//时间
let mDuration = 0.5

//timingFunction
let Linear = "linear"
let EaseIn = "easeIn"
let EaseOut = "easeOut"
let EaseInEaseOut = "easeInEaseOut"

class LYCATransition: CATransition {
    
    
    class func caTransition(type:String ,subType:String ,duration:Double ,timingName:String) -> LYCATransition {
        
        let animation = LYCATransition()
        animation.type = CATransitionType(rawValue: type)
        animation.subtype = CATransitionSubtype(rawValue: subType)
        animation.duration = CFTimeInterval(duration)
        animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName(rawValue: timingName))
        return animation
    }
    
}
